package example

import (
	"code.google.com/p/go-glue/rlglue"
	"math/rand"
)

type RandomAgent struct{ ts *rlglue.TaskSpec }

func (ra *RandomAgent) AgentInit(taskString string) {
	ra.ts, _ = rlglue.ParseTaskSpec(taskString)
}
func (ra *RandomAgent) AgentStart(obs rlglue.Observation) rlglue.Action {
	index := uint64(rand.Int63n(int64(ra.ts.Obs.Ints.Count())))
	return rlglue.NewAction(ra.ts.Obs.Ints.Values(index), []float64{}, []byte{})
}
func (ra *RandomAgent) AgentStep(reward float64, obs rlglue.Observation) rlglue.Action {
	index := uint64(rand.Int63n(int64(ra.ts.Obs.Ints.Count())))
	return rlglue.NewAction(ra.ts.Obs.Ints.Values(index), []float64{}, []byte{})
}
func (ra *RandomAgent) AgentEnd(reward float64) {
}
func (ra *RandomAgent) AgentCleanup() {
}
func (ra *RandomAgent) AgentMessage(message string) string {
	return ""
}
